
#include "IClassLong.h"
#include "member_BClass.h"

using namespace BWE;

ClassLong::ClassLong() : BClass("long", true)
{

	insertMethod("long()", &ClassLong::create);
	insertMethod("long(int)", &ClassLong::create_int);
	insertMethod("long(long)", &ClassLong::create_long);
	insertMethod("long(real)", &ClassLong::create_real);
	insertMethod("long(float)", &ClassLong::create_float);
	insertMethod("long(double)", &ClassLong::create_double);
	insertMethod("~long()", &ClassLong::release);

	insertMethod("long =(bool)", &ClassLong::assign_bool);
	insertMethod("long =(int)", &ClassLong::assign_int);
	insertMethod("long =(long)", &ClassLong::assign_long);
	insertMethod("long =(real)", &ClassLong::assign_real);
	insertMethod("long =(float)", &ClassLong::assign_float);
	insertMethod("long =(double)", &ClassLong::assign_double);

	insertMethod("long +()", &ClassLong::positive);
	insertMethod("long -()", &ClassLong::negative);
	insertMethod("long ++()", &ClassLong::plus_plus);
	insertMethod("long --()", &ClassLong::minus_minus);

	insertMethod("long +(int)", &ClassLong::plus_int);
	insertMethod("long +(long)", &ClassLong::plus_long);
	insertMethod("real +(real)", &ClassLong::plus_real);
	insertMethod("float +(float)", &ClassLong::plus_float);
	insertMethod("double +(double)", &ClassLong::plus_double);

	insertMethod("+=(int)", &ClassLong::plus_assign_int);
	insertMethod("+=(long)", &ClassLong::plus_assign_long);
	insertMethod("+=(real)", &ClassLong::plus_assign_real);
	insertMethod("+=(float)", &ClassLong::plus_assign_float);
	insertMethod("+=(double)", &ClassLong::plus_assign_double);

	insertMethod("long -(int)", &ClassLong::minus_int);
	insertMethod("long -(long)", &ClassLong::minus_long);
	insertMethod("real -(real)", &ClassLong::minus_real);
	insertMethod("float -(float)", &ClassLong::minus_float);
	insertMethod("double -(double)", &ClassLong::minus_double);

	insertMethod("-=(int)", &ClassLong::minus_assign_int);
	insertMethod("-=(long)", &ClassLong::minus_assign_long);
	insertMethod("-=(real)", &ClassLong::minus_assign_real);
	insertMethod("-=(float)", &ClassLong::minus_assign_float);
	insertMethod("-=(double)", &ClassLong::minus_assign_double);

	insertMethod("long *(int)", &ClassLong::mult_int);
	insertMethod("long *(long)", &ClassLong::mult_long);
	insertMethod("real *(real)", &ClassLong::mult_real);
	insertMethod("float *(float)", &ClassLong::mult_float);
	insertMethod("double *(double)", &ClassLong::mult_double);

	insertMethod("*=(int)", &ClassLong::mult_assign_int);
	insertMethod("*=(long)", &ClassLong::mult_assign_long);
	insertMethod("*=(real)", &ClassLong::mult_assign_real);
	insertMethod("*=(float)", &ClassLong::mult_assign_float);
	insertMethod("*=(double)", &ClassLong::mult_assign_double);

	insertMethod("long /(int)", &ClassLong::div_int);
	insertMethod("long /(long)", &ClassLong::div_long);
	insertMethod("real /(real)", &ClassLong::div_real);
	insertMethod("float /(float)", &ClassLong::div_float);
	insertMethod("double /(double)", &ClassLong::div_double);

	insertMethod("/=(int)", &ClassLong::div_assign_int);
	insertMethod("/=(long)", &ClassLong::div_assign_long);
	insertMethod("/=(real)", &ClassLong::div_assign_real);
	insertMethod("/=(float)", &ClassLong::div_assign_float);
	insertMethod("/=(double)", &ClassLong::div_assign_double);

	insertMethod("long %(int)", &ClassLong::mod_int);
	insertMethod("long %(long)", &ClassLong::mod_long);
	insertMethod("real %(real)", &ClassLong::mod_real);
	insertMethod("float %(float)", &ClassLong::mod_float);
	insertMethod("double %(double)", &ClassLong::mod_double);

	insertMethod("%=(int)", &ClassLong::div_assign_int);
	insertMethod("%=(long)", &ClassLong::div_assign_long);
	insertMethod("%=(real)", &ClassLong::div_assign_real);
	insertMethod("%=(float)", &ClassLong::div_assign_float);
	insertMethod("%=(double)", &ClassLong::div_assign_double);

	insertMethod("bool ==(bool)", &ClassLong::equal_bool);
	insertMethod("bool ==(int)", &ClassLong::equal_int);
	insertMethod("bool ==(long)", &ClassLong::equal_long);
	insertMethod("bool ==(float)", &ClassLong::equal_float);
	insertMethod("bool ==(double)", &ClassLong::equal_double);

	insertMethod("bool !=(bool)", &ClassLong::unequal_bool);
	insertMethod("bool !=(int)", &ClassLong::unequal_int);
	insertMethod("bool !=(long)", &ClassLong::unequal_long);
	insertMethod("bool !=(float)", &ClassLong::unequal_float);
	insertMethod("bool !=(double)", &ClassLong::unequal_double);

	insertMethod("bool >(int)", &ClassLong::greater_int);
	insertMethod("bool >(long)", &ClassLong::greater_long);
	insertMethod("bool >(float)", &ClassLong::greater_float);
	insertMethod("bool >(double)", &ClassLong::greater_double);

	insertMethod("bool <(int)", &ClassLong::less_int);
	insertMethod("bool <(long)", &ClassLong::less_long);
	insertMethod("bool <(float)", &ClassLong::less_float);
	insertMethod("bool <(double)", &ClassLong::less_double);

	insertMethod("bool >=(int)", &ClassLong::greater_equal_int);
	insertMethod("bool >=(long)", &ClassLong::greater_equal_long);
	insertMethod("bool >=(float)", &ClassLong::greater_equal_float);
	insertMethod("bool >=(double)", &ClassLong::greater_equal_double);

	insertMethod("bool <=(int)", &ClassLong::less_equal_int);
	insertMethod("bool <=(long)", &ClassLong::less_equal_long);
	insertMethod("bool <=(float)", &ClassLong::less_equal_float);
	insertMethod("bool <=(double)", &ClassLong::less_equal_double);

}

void ClassLong::create(int argc, BValue* argv)
{
	argv[0].refer() = (long long)0;
}
void ClassLong::create_int(int argc, BValue* argv)
{
	int i = argv[1];
	argv[0].refer() = (long long)i;
}
void ClassLong::create_long(int argc, BValue* argv)
{
	long long l = argv[1];
	argv[0].refer() = l;
}
void ClassLong::create_real(int argc, BValue* argv)
{
	BReal r = argv[1];
	argv[0].refer() = (long long)r;
}
void ClassLong::create_float(int argc, BValue* argv)
{
	float f = argv[1];
	argv[0].refer() = (long long)f;
}
void ClassLong::create_double(int argc, BValue* argv)
{
	double d = argv[1];
	argv[0].refer() = (long long)d;
}
void ClassLong::release(int argc, BValue* argv)
{
	argv[0].refer().clear();
}

void ClassLong::assign_bool(int argc, BValue* argv)
{
	long long& v = argv[0];
	bool b = argv[1];
	v = b ? 1 : 0;
}
void ClassLong::assign_int(int argc, BValue* argv)
{
	long long& v = argv[0];
	int i = argv[1];
	v = (long long)i;
}
void ClassLong::assign_long(int argc, BValue* argv)
{
	long long& v = argv[0];
	long long l = argv[1];
	v = l;
}
void ClassLong::assign_real(int argc, BValue* argv)
{
	long long& v = argv[0];
	BReal r = argv[1];
	v = (long long)r;
}
void ClassLong::assign_float(int argc, BValue* argv)
{
	long long& v = argv[0];
	float f = argv[1];
	v = (long long)f;
}
void ClassLong::assign_double(int argc, BValue* argv)
{
	long long& v = argv[0];
	double d = argv[1];
	v = (long long)d;
}

void ClassLong::positive(int argc, BValue* argv)
{
	
}
void ClassLong::negative(int argc, BValue* argv)
{
	long long& v = argv[0];
	argv[0] = -v;
}
void ClassLong::plus_plus(int argc, BValue* argv)
{
	long long& v = argv[0];
	argv[0] = v++;
}
void ClassLong::minus_minus(int argc, BValue* argv)
{
	long long& v = argv[0];
	argv[0] = v--;
}

void ClassLong::plus_int(int argc, BValue* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0] = (v + i);	
}
void ClassLong::plus_long(int argc, BValue* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0] = (v + l);	
}
void ClassLong::plus_real(int argc, BValue* argv)
{
	long long v = argv[0];
	BReal r = argv[1];
	argv[0] = (v + r);
}
void ClassLong::plus_float(int argc, BValue* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0] = (v + f);
}
void ClassLong::plus_double(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v + d);
}

void ClassLong::plus_assign_int(int argc, BValue* argv)
{
	long long& v = argv[0];
	int i = argv[1];
	v += i;
}
void ClassLong::plus_assign_long(int argc, BValue* argv)
{
	long long& v = argv[0];
	long long l = argv[1];
	v += l;
}
void ClassLong::plus_assign_real(int argc, BValue* argv)
{
	long long& v = argv[0];
	BReal r = argv[1];
	v = (long long)(v + r);
}
void ClassLong::plus_assign_float(int argc, BValue* argv)
{
	long long& v = argv[0];
	float f = argv[1];
	v = (long long)(v + f);
}
void ClassLong::plus_assign_double(int argc, BValue* argv)
{
	long long& v = argv[0];
	double d = argv[1];
	v = (long long)(v + d);
}

void ClassLong::minus_int(int argc, BValue* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0] = (v - i);
}
void ClassLong::minus_long(int argc, BValue* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0] = (v - l);
}
void ClassLong::minus_real(int argc, BValue* argv)
{
	long long v = argv[0];
	BReal r = argv[1];
	argv[0] = (v - r);
}
void ClassLong::minus_float(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v - d);
}
void ClassLong::minus_double(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v - d);
}

void ClassLong::minus_assign_int(int argc, BValue* argv)
{
	long long& v = argv[0];
	int i = argv[1];
	v -= i;
}
void ClassLong::minus_assign_long(int argc, BValue* argv)
{
	long long& v = argv[0];
	long long l = argv[1];
	v -= l;
}
void ClassLong::minus_assign_real(int argc, BValue* argv)
{
	long long& v = argv[0];
	BReal r = argv[1];
	v -= (long long)r;
}
void ClassLong::minus_assign_float(int argc, BValue* argv)
{
	long long& v = argv[0];
	float f = argv[1];
	v = (long long)(v - f);
}
void ClassLong::minus_assign_double(int argc, BValue* argv)
{
	long long& v = argv[0];
	double d = argv[1];
	v = (long long)(v - d);
}

void ClassLong::mult_int(int argc, BValue* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0] = (v * i);
}
void ClassLong::mult_long(int argc, BValue* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0] = (v * l);
}
void ClassLong::mult_real(int argc, BValue* argv)
{
	long long v = argv[0];
	BReal r = argv[1];
	argv[0] = (v * r);
}
void ClassLong::mult_float(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v * d);
}
void ClassLong::mult_double(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v * d);
}

void ClassLong::mult_assign_int(int argc, BValue* argv)
{
	long long& v = argv[0];
	int i = argv[1];
	v *= i;
}
void ClassLong::mult_assign_long(int argc, BValue* argv)
{
	long long& v = argv[0];
	long long l = argv[1];
	v *= l;
}
void ClassLong::mult_assign_real(int argc, BValue* argv)
{
	long long& v = argv[0];
	BReal r = argv[1];
	v *= (long long)r;
}
void ClassLong::mult_assign_float(int argc, BValue* argv)
{
	long long& v = argv[0];
	float f = argv[1];
	v = (long long)(v * f);
}
void ClassLong::mult_assign_double(int argc, BValue* argv)
{
	long long& v = argv[0];
	double d = argv[1];
	v = (long long)(v * d);
}

void ClassLong::div_int(int argc, BValue* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0] = (v / i);
}
void ClassLong::div_long(int argc, BValue* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0] = (v / l);
}
void ClassLong::div_real(int argc, BValue* argv)
{
	long long v = argv[0];
	BReal r = argv[1];
	argv[0] = (v / r);
}
void ClassLong::div_float(int argc, BValue* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0] = (v / f);
}
void ClassLong::div_double(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v / d);
}

void ClassLong::div_assign_int(int argc, BValue* argv)
{
	long long& v = argv[0];
	int i = argv[1];
	v /= i;
}
void ClassLong::div_assign_long(int argc, BValue* argv)
{
	long long& v = argv[0];
	long long l = argv[1];
	v /= l;
}
void ClassLong::div_assign_real(int argc, BValue* argv)
{
	long long& v = argv[0];
	BReal r = argv[1];
	v /= (long long)r;
}
void ClassLong::div_assign_float(int argc, BValue* argv)
{
	long long& v = argv[0];
	float f = argv[1];
	v = (long long)(v / f);
}
void ClassLong::div_assign_double(int argc, BValue* argv)
{
	long long& v = argv[0];
	double d = argv[1];
	v = (long long)(v / d);
}

void ClassLong::mod_int(int argc, BValue* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0] = (v % i);
}
void ClassLong::mod_long(int argc, BValue* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0] = (v % l);
}
void ClassLong::mod_real(int argc, BValue* argv)
{
	long long v = argv[0];
	BReal r = argv[1];
	argv[0] = (v / r);
}
void ClassLong::mod_float(int argc, BValue* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0] = (v / f);
}
void ClassLong::mod_double(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v / d);
}

void ClassLong::mod_assign_int(int argc, BValue* argv)
{
	long long& v = argv[0];
	int i = argv[1];
	v %= i;
}
void ClassLong::mod_assign_long(int argc, BValue* argv)
{
	long long& v = argv[0];
	long long l = argv[1];
	v %= l;
}
void ClassLong::mod_assign_real(int argc, BValue* argv)
{
	long long& v = argv[0];
	BReal r = argv[1];
	v /= (long long)r;
}
void ClassLong::mod_assign_float(int argc, BValue* argv)
{
	long long& v = argv[0];
	float f = argv[1];
	v = (long long)(v / f);
}
void ClassLong::mod_assign_double(int argc, BValue* argv)
{
	long long& v = argv[0];
	double d = argv[1];
	v = (long long)(v / d);
}

void ClassLong::equal_bool(int argc, BValue* argv)
{
	long long v = argv[0];
	bool b = argv[1];
	argv[0] = ((bool)v == b);
}
void ClassLong::equal_int(int argc, BValue* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0] = (v == i);
}
void ClassLong::equal_long(int argc, BValue* argv)
{
	long long v = argv[0];
	long l = argv[1];
	argv[0] = (v == l);
}
void ClassLong::equal_float(int argc, BValue* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0] = (v == f);
}
void ClassLong::equal_double(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v == d);
}

void ClassLong::unequal_bool(int argc, BValue* argv)
{
	long long v = argv[0];
	bool b = argv[1];
	argv[0] = ((bool)v != b);	
}
void ClassLong::unequal_int(int argc, BValue* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0] = (v != i);	
}
void ClassLong::unequal_long(int argc, BValue* argv)
{
	long long v = argv[0];
	long l = argv[1];
	argv[0] = (v != l);	
}
void ClassLong::unequal_float(int argc, BValue* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0] = (v != f);	
}
void ClassLong::unequal_double(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v != d);
}

void ClassLong::greater_int(int argc, BValue* argv)
{
	long long v = argv[0];
	int i1 = argv[1];
	argv[0] = (v > i1);
}
void ClassLong::greater_long(int argc, BValue* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0] = (v > l);
}
void ClassLong::greater_float(int argc, BValue* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0] = (v > f);
}
void ClassLong::greater_double(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v > d);
}

void ClassLong::less_int(int argc, BValue* argv)
{
	long long v = argv[0];
	int i1 = argv[1];
	argv[0] = (v < i1);
}
void ClassLong::less_long(int argc, BValue* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0] = (v < l);
}
void ClassLong::less_float(int argc, BValue* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0] = (v < f);
}
void ClassLong::less_double(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v < d);
}

void ClassLong::greater_equal_int(int argc, BValue* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0] = (v >= i);
}
void ClassLong::greater_equal_long(int argc, BValue* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0] = (v >= l);
}
void ClassLong::greater_equal_float(int argc, BValue* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0] = (v >= f);
	
}
void ClassLong::greater_equal_double(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v >= d);
}

void ClassLong::less_equal_int(int argc, BValue* argv)
{
	long long v = argv[0];
	int i = argv[1];
	argv[0] = (v <= i);
}
void ClassLong::less_equal_long(int argc, BValue* argv)
{
	long long v = argv[0];
	long long l = argv[1];
	argv[0] = (v <= l);
}
void ClassLong::less_equal_float(int argc, BValue* argv)
{
	long long v = argv[0];
	float f = argv[1];
	argv[0] = (v <= f);
}
void ClassLong::less_equal_double(int argc, BValue* argv)
{
	long long v = argv[0];
	double d = argv[1];
	argv[0] = (v <= d);
}
